#include <bits/stdc++.h>
#include<unordered_set>

#define ll long long
#define ull unsigned long long
#define uint unsigned int

#define YES cout << "YES" << '\n'
#define NO cout << "NO" << '\n'
#define endl '\n'
const int INF = 1e9;
const int MOD = 998244353;
using namespace std;

/*思考

*/

void solve() {
    int n = 0;
    int j = 0;
    int k = 0;
    int a[200001] = { 0 };
    cin >> n>>j>>k;
    int m = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        m = max(m, a[i]);
    }
    if (k != 1) {
        YES;
    }
    else if(m==a[j]) {//是最大值
         YES;
    }
    else {//不是最大值
        NO;
    }
    
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 0;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}